package com.zhc.dejingapi.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhc.dejingapi.entity.QingDepartmentEntity;
import com.zhc.dejingapi.entity.vo.SelectVo;
import com.zhc.dejingapi.mapper.QingDepartmentMapper;
import com.zhc.dejingapi.service.QingDepartmentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 轻流部门档案 服务实现类
 * </p>
 *
 * @author zhc
 * @since 2024-10-11
 */
@Service
public class QingDepartmentServiceImpl extends ServiceImpl<QingDepartmentMapper, QingDepartmentEntity> implements QingDepartmentService {

    @Resource
    private QingDepartmentMapper qingDepartmentMapper;
    @Override
    public List<SelectVo> getDepartment() {
        List<SelectVo> selectVos = new ArrayList<>();
        List<QingDepartmentEntity> qingDepartmentEntities = qingDepartmentMapper.selectList(null);
        for (QingDepartmentEntity qingDepartmentEntity:qingDepartmentEntities) {
            SelectVo selectVo = new SelectVo();
            selectVo.setValue(qingDepartmentEntity.getDepCode());
            selectVo.setLabel(qingDepartmentEntity.getDepName());
            selectVo.setText(qingDepartmentEntity.getDepName());
            selectVos.add(selectVo);
        }
        return selectVos;
    }
}
